About 777 letters

About 4 minutes

#type

Description: Get the type.

def type(obj):
    '''
    Get the type

    :param obj: a variable
    :return: the type of obj
    '''

def type(name, bases, dict, **kwds):
    '''
    Create a type

    :param name: type name
    :param bases: base classes
    :param dict: attribute dictionary
    :param kwds: additional attributes
    :return: the new type
    '''

Example:

print(type(233))
print(type(3.14))
print(type('hello world'))
print(type([1, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6]))

obj = type('MyClass', (), {'name':'Alice', 'age':18})
print(obj, obj.name, obj.age)

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

Updated: 6/9/2025

Author: PlanC

Created: 6/9/2025